Here's How Investors Can Turn Stock Losses Into Tax Savings